package com.collect.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @Classname Result
 * @Description TODO
 * @Date 2025/3/10 09:50
 * @Created by xxx
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> implements Serializable {

    private Integer code; //编码：0成功，-1失败
    private String[] msg; //信息
    private String fileId; //数据

    public static <T> Result<T> success(String fileId) {
        Result<T> result = new Result<T>();
        result.code = 0;
        result.msg = new String[]{};
        result.fileId = fileId;
        return result;
    }


    public static <T> Result<T> error(String fileId, String[] msg) {
        Result result = new Result();
        result.msg = msg;
        result.code = -1;
        result.fileId = fileId;
        return result;
    }

}
